################################
#
#     Makefile Assegnamento 1 AA 2017/18
#    
################################


# file da consegnare
FILE_DA_CONSEGNARE=gasret.c

# preferenze compilatore e flag di compilazione
CC=gcc
# compilazione senza attesa
#CFLAGS= -Wall -pedantic -g
# compilazione con attesa
CFLAGS= -Wall -pedantic -g -DWAIT

obj = gasret.o

# phony targets
.PHONY: cleanall test1 test2 test3 test4 consegna 


gas1 : 01test.o $(obj)
	gcc $(obj) 01test.o -o gas1 -lm

gas2 : 02test.o $(obj)
	gcc $(obj) 02test.o -o gas2 -lm

gas3 : 03test.o $(obj)
	gcc $(obj) 03test.o -o gas3 -lm

gas4 : 04test.o $(obj)
	gcc $(obj) 04test.o -o gas4 -lm




gasret.o: gasret.c gasret.h 
01test.o: 01test.c gasret.h 
02test.o: 02test.c gasret.h 
03test.o: 03test.c gasret.h 
04test.o: 04test.c gasret.h 


cleanall: 
	-rm -f *.o *~ ./core gas?


test1:
	make cleanall
	make gas1
	./gas1 
	@echo "********** Test1 superato!"

test2: 
	make cleanall
	make gas2
	./gas2 
	@echo "********** Test2 superato!"


test3: 
	make cleanall
	make gas3
	./gas3 
	@echo "********** Test3 superato!"


test4: 
	make cleanall
	make gas4
	./gas4 
	@echo "********** Test4 superato!"



consegna:
	make cleanall
	make test1
	make test2
	make test3
	make test4
	./gruppo-check.pl < gruppo.txt
	tar -cvf $(USER)-a1.tar ./gruppo.txt  $(FILE_DA_CONSEGNARE) 
	@echo "********** TAR creato inviare in allegato a una mail al docente del proprio corso insieme a nome, cognome,  numero di matricola dei componenti del gruppo"
